<!--
描述：教学计划-年级管理维护组件
开发人：hqj
开发日期：2018年8月7日
-->
<template lang="pug">
    keep-alive
        kalix-table(bizKey="grade" title='年级列表' v-bind:targetURL="targetURL" v-bind:bizDialog="bizDialog"
        v-bind:tableFields="tableFields" bizSearch="GradeSearch" v-bind:btnList="btnList"
        v-bind:customTableTool="customTableTool" ref="gradeTable")
</template>

<script type="text/ecmascript-6">
    import {gradeURL} from '../../config.toml'
    import {gradeBtnList} from './config'

    export default {
        name: 'kalix-admin-grade',
        data() {
            return {
                btnList: gradeBtnList,
                targetURL: gradeURL,
                tableFields: [
                    {prop: 'grade', label: '年级'},
                    {prop: 'startDate', label: '起始日期'},
                    {prop: 'endDate', label: '结束日期'}
                ],
                bizDialog: [
                    {id: 'add', dialog: 'GradeAdd'},
                    {id: 'edit', dialog: 'GradeAdd'},
                    {id: 'view', dialog: 'GradeView'},
                    {id: 'addMajor', dialog: 'GradeAddMajors'}
                ]
            }
        },
        created() {
        },
        methods: {
            customTableTool(row, btnId, that) {
                switch (btnId) {
                    // 添加专业
                    case 'addMajor':
                        that.whichBizDialog = ''
                        let dig = that.bizDialog.filter((item) => {
                            return item.id === 'addMajor'
                        })
                        that.whichBizDialog = dig[0].dialog
                        setTimeout(() => {
                            that.$refs.kalixDialog.$refs.kalixBizDialog.open(row.grade + '级添加专业', false, row)
                        }, 20)
                        break
                }
            }
        }
    }
</script>

<style scoped lang="stylus" type="text/stylus">
</style>
